2838bfb7166ec5675a0e24ebb9af219992b8b09f,platform/platform-impl/src/com/intellij/openapi/project/CacheUpdateRunner.java,CacheUpdateRunner,processSomeFilesWhileUserIsInactive,#FileContentQueue#Consumer#boolean#,116

Before Change



    final boolean[] isFinished = new boolean[1];
    try {
      ProgressManager.getInstance().runProcess(new Runnable() {
        public void run() {
          while (true) {
            if (myProject.isDisposed()) return;
            if (innerIndicator.isCanceled()) return;

            final FileContent fileContent = queue.take();
            if (fileContent == null) {
              isFinished[0] = true;
              return;
            }

            try {
              final Runnable action = new Runnable() {
                public void run() {
                  innerIndicator.checkCanceled();

                  if (myProject.isDisposed()) return;

                  final VirtualFile file = fileContent.getVirtualFile();
                  progressUpdater.consume(file);
                  mySession.processFile(fileContent);
                }
              };
              if (processInReadAction) {
                application.runReadAction(action);
              }
              else {
                action.run();
              }
            }
            catch (ProcessCanceledException e) {
              queue.pushback(fileContent);
              return;
            }
          }
        }
      }, innerIndicator);
    }
    finally {
      application.removeApplicationListener(canceller);

After Change


    try {
      int threadsCount = Registry.intValue("caches.indexerThreadsCount");
      if (threadsCount == 1) {
        Runnable process = new MyRunnable(innerIndicator, queue, isFinished, progressUpdater, processInReadAction, application);
        ProgressManager.getInstance().runProcess(process, innerIndicator);
      }
      else {
        Job<Object> job = JobScheduler.getInstance().createJob("Indexing", Thread.NORM_PRIORITY);